package com.intranet.sys.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.intranet.sys.domain.Menu;
import com.water.dao.BaseDao;
@Repository
public class MenuDao extends BaseDao<Menu> {

	private final String GET_MENU_BY_PID = "from Menu m where m.status='Y' and m.parentId = ?";
	
	private final String GET_ALLMENU = "from Menu m where m.status='Y'";

	/**
	 * 
	 * @return
	 */
	public List<Menu> getAllMenu(){
		return getHibernateTemplate().find(GET_ALLMENU);
	} 
	
	public List<Menu> getMenuByPId(int pid) {
		List<Menu> menus = getHibernateTemplate().find(GET_MENU_BY_PID,pid);
		return menus;
	}
}
